UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IDeTzzB0IN1iMlsd03fIkkJgDGNQsVZeeUbISSD1lI8=' 
WHERE 
  key_id = '027c5173a15865309820f2cb82b97bd048c2d0c7f9a28f3fb3981a1a7f96c21b' 
  AND (
    token = 'IDeTzzB0IN1iMlsd03fIkkJgDGNQsVZeeUbISSD1lI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030