UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TAK1yrn8brMXD13PFz996oCcOMkuPPifoIF3tU4SQvs=' 
WHERE 
  key_id = 'da6c1be34af287e153eb9df71aa19c99b0a39b9794fcf4354fd1d54a7d6e6a2e' 
  AND (
    token = 'TAK1yrn8brMXD13PFz996oCcOMkuPPifoIF3tU4SQvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040