UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qp99c0uNwRhIqlTCyCnpof/Qfgt/ZwOzDYFgJwhtKhU=' 
WHERE 
  key_id = 'ee518bce9ecae8af2061a8949933611f59e0e5e08f3c83edba952289997f6159' 
  AND (
    token = 'qp99c0uNwRhIqlTCyCnpof/Qfgt/ZwOzDYFgJwhtKhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041