UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ttFSGOFkwgogO3RuRJ+I21677UAjb5wSDSbRr7Vcz7k=' 
WHERE 
  key_id = '2e97d0b96d5044f3aa57c6fe695290da995118a1e32107bcd54f0ffafcb92037' 
  AND (
    token = 'ttFSGOFkwgogO3RuRJ+I21677UAjb5wSDSbRr7Vcz7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022