UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Yetm9AcV05QRvhgkpihQhqywBuhmG4TxDGrh4lwE0k=' 
WHERE 
  key_id = 'b66577efd2218c2571deec04cd9642ba591e17a173ea1cbb2a8683884e20c111' 
  AND (
    token = '0Yetm9AcV05QRvhgkpihQhqywBuhmG4TxDGrh4lwE0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048