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

Query time 0.00041