UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k/4LJ/4J91aV5oZ/QuPKZKl/OsusAxpS0EH9+2o/DoQ=' 
WHERE 
  key_id = '1a859b5de5c16f9655d1da5ea0c4391fb915039023b82f27dcd727025dba2df6' 
  AND (
    token = 'k/4LJ/4J91aV5oZ/QuPKZKl/OsusAxpS0EH9+2o/DoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040