UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g61P7cVXMwBvEnGmNSbOKhtbha0+aX+8OJEGYFUyGzc=' 
WHERE 
  key_id = '18668fabac6db187487f7e3d6f85b4d2ac62eaeb706d77e13dacc4d57bb11901' 
  AND (
    token = 'g61P7cVXMwBvEnGmNSbOKhtbha0+aX+8OJEGYFUyGzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015