UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TUuYA0gu6vWeJBHzRckF8P3wv8EzHRtQnQACduH2mm4='
WHERE
key_id = '8ed01883c2e114c751a0d428b65c3eff079c4539e113b9977e91889db1dd5170'
AND (
token = 'TUuYA0gu6vWeJBHzRckF8P3wv8EzHRtQnQACduH2mm4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)