UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YaQMPe7oXTzUUSQrU6C1BieRPeIQyKesr1Iowoy7+bw=' 
WHERE 
  key_id = 'a30dbaa23fa07df85d9da553493013aa17e445d583f40d56d17a0a4260aac6de' 
  AND (
    token = 'YaQMPe7oXTzUUSQrU6C1BieRPeIQyKesr1Iowoy7+bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039