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