UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5voT/8MeNg4xf5a2dyXsdCHGw4vmXIdIGdJRsfvyESo='
WHERE
key_id = '1fbc5e348e860a62f8f91676d04ca2a5afc33f9e9a220218f705665c8f9fdb19'
AND (
token = '5voT/8MeNg4xf5a2dyXsdCHGw4vmXIdIGdJRsfvyESo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)