UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gVpq9rUjRZeYdIcbVwUqhMzZXTz94m7zrG5FjYkGTxk='
WHERE
key_id = '12c807e3d7494adf27493400530a348344a94235849548c4c73dc96e3cea58d8'
AND (
token = 'gVpq9rUjRZeYdIcbVwUqhMzZXTz94m7zrG5FjYkGTxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)