UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rSBFfKbHZzWZDU2EJ89oCEbrc8UUTGUx1lhPJfAUf48='
WHERE
key_id = 'aeb6f8af428e0c40216c85328129788f1686b371761e8db29611dadb86d0c4b5'
AND (
token = 'rSBFfKbHZzWZDU2EJ89oCEbrc8UUTGUx1lhPJfAUf48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)