UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'byhSDgYesQGFIOaEf08x5jpfAJYGilodf/tKsCWpses='
WHERE
key_id = 'f8a18085811a7c7991e25ea294a43c43b5d4bf206165364bc3039823d056f4d1'
AND (
token = 'byhSDgYesQGFIOaEf08x5jpfAJYGilodf/tKsCWpses='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)