UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y4Da620awKDBKI96Eu9w89t9EdRX4IlHgTIRmkZfypU='
WHERE
key_id = '8b14e4863d21b6db174a6be26b0969428ca7248ba4f7c707a4800aae1ad612bc'
AND (
token = 'Y4Da620awKDBKI96Eu9w89t9EdRX4IlHgTIRmkZfypU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)