UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NJbmG4JVP6n8vqYW53roKSyzGvWPb1YZsd4l+t2rs34='
WHERE
key_id = 'cd82dc0e7a1966f393feb9ce4bcdd400cd2ecdf3b37ea2fad1930ef1e210095e'
AND (
token = 'NJbmG4JVP6n8vqYW53roKSyzGvWPb1YZsd4l+t2rs34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)