UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dYECeqa2i/tWSFGczXfGMraY59sQpS0JKJuCXi0ipNY=' 
WHERE 
  key_id = 'f3d082193ad0fc13bec2b47fd90dd5cc23cd1b64052182810c4d9ae269f6dd1f' 
  AND (
    token = 'dYECeqa2i/tWSFGczXfGMraY59sQpS0JKJuCXi0ipNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059