UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lD+Ywe+3la0fODel4xTlJBLY5H02FHfjnhyKi2bjDAo='
WHERE
key_id = 'd8f5aa1b075874d8602935505d44caa765ac1dfb612a127d363e7146f1962c39'
AND (
token = 'lD+Ywe+3la0fODel4xTlJBLY5H02FHfjnhyKi2bjDAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)