UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kRupUqApgjCEB2TB2p3SRp+preV4xLq8oNZBuFXVcAw=' 
WHERE 
  key_id = '9257c847c2c66f8f23c967df596ff7298e78253fbfed7f2bfee1d62541cadbbd' 
  AND (
    token = 'kRupUqApgjCEB2TB2p3SRp+preV4xLq8oNZBuFXVcAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036