UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pf3NwMAlEJ9+sx2BTikwZw0XMifkjsRL0/ToENMl6+8='
WHERE
key_id = '7a18b5bea5f1fb52b24ea254eda810db1dc5c1d88b52235e2f28a7b42271611d'
AND (
token = 'Pf3NwMAlEJ9+sx2BTikwZw0XMifkjsRL0/ToENMl6+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)