UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qCnekWnfUViH19NfVlQWO6iyRt7QRwfBjtSFWgUhNjc=' 
WHERE 
  key_id = '06f5c563de0bd4fcc845df5a8da58b5df28172936b271596113b025c9476fee4' 
  AND (
    token = 'qCnekWnfUViH19NfVlQWO6iyRt7QRwfBjtSFWgUhNjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036