UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oa5B3LsXhkwnUBGLYvDzG5f6pF6N45yfh+g+A+PWOQI='
WHERE
key_id = '46522f4e2d80c9e4d679413b2bb5978211e28a5ea5f8751a2c4018fe30790de0'
AND (
token = 'oa5B3LsXhkwnUBGLYvDzG5f6pF6N45yfh+g+A+PWOQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)