UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l49wYKjk9oFm7ETJOBogzeeiZur3XW+kVhvS8YqySk0=' 
WHERE 
  key_id = '4f3ed9667317b53a8ce8803c4dad09811a7072aba378a0a131b698719a1e1727' 
  AND (
    token = 'l49wYKjk9oFm7ETJOBogzeeiZur3XW+kVhvS8YqySk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022