UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pw+1CJIq5NRvjWotOz34BSnH/r5kLnulo90JPgBABLI=' 
WHERE 
  key_id = '95e7c36a869c8931b6b0b4243de18aac8cf37b87fd308eab05877b9098442593' 
  AND (
    token = 'pw+1CJIq5NRvjWotOz34BSnH/r5kLnulo90JPgBABLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056