UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2fMEHeGIootgjrm0LYrjzbMhuSufJQzJYycy2MD7GPw='
WHERE
key_id = 'd540b7af46b7f9db524d22c111bb8fb6959142b8844455367c2cf5b37d2672ef'
AND (
token = '2fMEHeGIootgjrm0LYrjzbMhuSufJQzJYycy2MD7GPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)