UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NUOg/mQVtrIbyApYAeK1B7BKzF5bO7uW/oHpxnkClXI='
WHERE
key_id = '4140746e62062ba6a4267b7ebdcff7486a1b0462ecdc9b86600b7dbbbf029fd0'
AND (
token = 'NUOg/mQVtrIbyApYAeK1B7BKzF5bO7uW/oHpxnkClXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)