UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnnIh/uTJGQIsETNhZRw78X9B/wkhPXwUjRFvAjKidU=' 
WHERE 
  key_id = '25cd9af001db53bcf9460583646d3e09ac62d4ba78ab263234188cbd4078872f' 
  AND (
    token = 'TnnIh/uTJGQIsETNhZRw78X9B/wkhPXwUjRFvAjKidU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047