UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XE2fdrlPzcNrRimrbRiHUwt4xF1byDUAlfP9GJuVYgo='
WHERE
key_id = 'f91e8294bf266085e97ac4acada5eb1dd20c3a56665e437ffc5bb86182051729'
AND (
token = 'XE2fdrlPzcNrRimrbRiHUwt4xF1byDUAlfP9GJuVYgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)