UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qSTtQLhCLhAzTARYe2K7qNYtp0yeS+sNbtADIq9TsT4=' 
WHERE 
  key_id = 'bc687bce02b79d0f20f0c85855debf70df7ac05fbc2a8930a51a6ede5de3a999' 
  AND (
    token = 'qSTtQLhCLhAzTARYe2K7qNYtp0yeS+sNbtADIq9TsT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025