UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kBeEnwXNhJOCMiT4XenXDKYuVkfkcWBCyP1jhT+08Do='
WHERE
key_id = '3dc95a3e60420b8969e0d5b8f8bfd0d26edae824f88a0b84a9bcc75f1227e575'
AND (
token = 'kBeEnwXNhJOCMiT4XenXDKYuVkfkcWBCyP1jhT+08Do='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)